// import { createRouter, createWebHistory } from "vue-router";
import NProgress from "nprogress";
import "nprogress/nprogress.css"; // nprogress样式文件
import {
  createRouter,
  createWebHistory,
  createWebHashHistory,
} from "vue-router";
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "首页",
      component: () => import("@/views/index.vue"),
    },
    {
      path: "/lixiangku",
      name: "立项库",
      component: () => import("@/views/lxk.vue"),
    },
    {
      path: "/jstzk",
      name: "建设投资库",
      component: () => import("@/views/jstzk.vue"),
    },
    {
      path: "/gongdiku",
      name: "工地库",
      component: () => import("@/views/gdk.vue"),
    },{
      path:'/demo',
      name:'demo',
      component:()=>import('@/views/demo.vue')
    }
  ],
});
//当路由开始跳转时
router.beforeEach((to, from, next) => {
  // 开启进度条
  NProgress.start();
  // 这个一定要加，没有next()页面不会跳转的。这部分还不清楚的去翻一下官网就明白了
  next();
});
//当路由跳转结束后
router.afterEach(() => {
  // 关闭进度条
  NProgress.done();
});

export default router;
